from fractions import gcd

def funny_simplify(a, b):
	if (int(a/10) == int(b/10) and b%10 != 0 and (a%10)/(b%10) == a/b):
			return True
	if (int(a/10) == b%10 and (a%10)/int(b/10) == a/b):
			return True
	if (a%10 == int(b/10) and b%10 != 0 and int(a/10)/(b%10) == a/b):
			return True
	if (a%10 == b%10 and int(a/10)/int(b/10) == a/b):
			return True
	return False

biga=1
bigb=1
for b in range(11, 100):
	for a in range(10, b):
		if a%10 + b%10 != 0 and funny_simplify(a,b): 
			biga*=a
			bigb*=b

print(bigb/gcd(biga,bigb))